<script lang="ts" setup>

const props = defineProps({
  classList: Array<any>,
})
</script>

<template>
  <view class="free-card-box">
    <view class="free-card-item" v-for="(item, index) in props.classList" :key="index">
      <view class="free-card-img">
        <image :src="item.teacher_logo" mode=""></image>
      </view>
      <view class="free-card-text">
        <view class="free-card-title">{{item.limitName}}</view>
        <view class="free-card-info">
          <view class="free-card-info-text">
            <view class="info-text">{{item.teacher_name}}&nbsp;&nbsp;{{item.teacher_job}}</view>
            <view>{{item.limitNum}}人学过</view>
          </view>
          <view class="free-card-info-btn" v-if="item.baoming == `立即学习`">{{item.baoming}}</view>
          <view class="free-card-info-btn btn-disable" v-else>{{item.baoming}}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
.free-card-box {
  .free-card-item {
    display: flex;
    padding: 10px;
    margin: 10px 0;
    border-radius: 10px;
    box-shadow: 0 0 5px 1px rgba($color: #000000, $alpha: 0.1);
    box-sizing: border-box;
    align-items: center;
    background-color: #fff;

    .free-card-img {
      margin-right: 10px;
      flex-shrink: 0;
      width: 91rpx;
      height: 91rpx;
      border-radius: 100%;

      image {
        width: 100%;
        height: 100%;
        border-radius: 100%;
      }
    }

    .free-card-text {
      flex: 1;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;

      .free-card-title {
        font-size: 16px;
        margin: 5px 0;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }

      .free-card-info {
        box-sizing: border-box;
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;

        .free-card-info-text {
          font-size: 16px;
          width: 60%;
          overflow: hidden;
          color: #666;

          .info-text {
            font-size: 14px;
            height: 20px;
            overflow: hidden;
          }
        }
        .free-card-info-btn {
          font-size: 16px;
          line-height: 34px;
          text-align: center;
          width: 100px;
          height: 34px;
          border-radius: 34px;
          background-color: #00b793;
          color: white;
          margin-top: 10px;
        }
        .btn-disable {
          background-color: #ddd;
        }
      }
    }
  }
}
</style>
